package com.atguigu.controller;

import com.atguigu.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Date:2020/9/29
 * Author:ybc
 * Description:
 */
@Controller
public class AjaxController {

    /*@RequestMapping("/testAjax")
    public void testAjax(HttpServletResponse response) throws IOException {
        response.getWriter().print("success");
    }*/


    @RequestMapping("/testAjax")
    @ResponseBody
    public String testAjax() {
        return "success";
    }

    @RequestMapping("/testJson")
    @ResponseBody
    public User testJson(){
        User user = new User(1001,"admin","123",23);
        return user;
    }
}
